#include"processBar.h"
#include<unistd.h>


typedef void (*callback_t)(int);

void downLoad(callback_t cb)
{
    int total = 1000;
    int curr = 0;
    while(curr <= total)
    {
        usleep(50000);
        int rate = curr * 100 / total; 
        cb(rate);
        curr += 10; 
    }
    printf("\n");
}


int main()
{
    printf("downLond 1:\n");
    downLoad(processbar);

    printf("downLond 2:\n");
    downLoad(processbar);

    printf("downLond 3:\n");
    downLoad(processbar);

    printf("downLond 4:\n");
    downLoad(processbar);

    printf("downLond 5:\n");
    downLoad(processbar);
    return 0;
}
